home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / v10n12.arc / DPMIINFO.C < prev    next >
Text File  |  1991-05-30  |  2KB  |  66 lines

  1. /* 
  2. DPMIINFO.C -- display DPMI information under Windows
  3.  
  4. Copyright (c) 1991 Ziff Communications Co.
  5.     PC Magazine * Andrew Schulman
  6.         
  7. Borland C++ 2.0:
  8.     bcc -W -2 dpmiinfo.c printf.c dpmi.c
  9.     rc dpmiinfo.exe
  10.         
  11. Microsoft C 6.0:
  12.     cl -c -AS -G2sw -Oais -Zpe dpmiinfo.c printf.c dpmi.c
  13.     link /align:16 dpmiinfo printf dpmi,dpmiinfo,,/nod slibcew libw,wi|n.def
  14.     rc dpmiinfo.exe
  15. */
  16.  
  17. #include <stdlib.h>
  18. #include <stdarg.h>
  19. #include <string.h>
  20. #include <dos.h>
  21. #include <windows.h>
  22. #include "printf.h"
  23. #include "dpmi.h"
  24.  
  25. #define FAIL(s) MessageBox(NULL, s, "DPMI Information", MB_OK)
  26.  
  27. int PASCAL WinMain(HANDLE hInstance, HANDLE hPrevInstance,
  28.     LPSTR lpszCmdLine, int nCmdShow)
  29. {
  30.     unsigned long win_flags;
  31.     unsigned flags;
  32.     unsigned maj, min;
  33.     unsigned proc;
  34.     
  35.     if (! ((win_flags = GetWinFlags()) & WF_PMODE))
  36.         return FAIL("This program requires Windows "
  37.                     "Standard or Enhanced mode");
  38.     
  39.     if (! dpmi_present())
  40.         return FAIL("DPMI not present");
  41.  
  42.     dpmi_version(&maj, &min, &flags, &proc);
  43.     
  44.     open_display("DPMI Information");
  45.     
  46.     if (win_flags & WF_STANDARD)
  47.         printf("DPMI %x.%x\n", maj, min); // silly bug in Standard mode
  48.     else
  49.         printf("DPMI %d.%d\n", maj, min);
  50.  
  51.     printf("Windows %s mode running on an 80%d86\n",
  52.         (win_flags & WF_ENHANCED) ? "Enhanced" : 
  53.         (win_flags & WF_STANDARD) ? "Standard" : "Not Another?!",
  54.         proc); // processor: 2=286, 3=386, 4=486
  55.             
  56.     printf("%d-based DPMI implementation\n",
  57.         (flags & 1) ? 386 : 286);
  58.     printf("Interrupts reflected to %s mode\n",
  59.         (flags & 2) ? "real" : "V86");
  60.     printf("%s virtual memory\n",
  61.         (flags & 4) ? "Supports" : "No");
  62.     
  63.     show_display();
  64.     return 0;
  65. }
  66.